﻿using System;
using System.Collections.Generic;

namespace NRank.Examples.Helpers
{
	/// <summary>
	/// Database emulation
	/// </summary>
	public class DatabaseContext : IDisposable
	{
		/// <summary>
		/// Table Hotels
		/// </summary>
		private readonly List<Hotel> hotels;

		/// <summary>
		/// Table Muzeums
		/// </summary>
		private readonly List<Muzeum> muzeums;

		/// <summary>
		/// Creates instance of the virtual database
		/// </summary>
		public DatabaseContext()
		{
			this.hotels = new List<Hotel>
			              	{
			              		new Hotel{Area = "Area1", Name = "Hotel1",Stars = 4},
			              		new Hotel{Area = "Area1", Name = "Hotel2",Stars = 1},
			              		new Hotel{Area = "Area2", Name = "Hotel3",Stars = 2},
			              		new Hotel{Area = "Area2", Name = "Hotel4",Stars = 3},
			              		new Hotel{Area = "Area3", Name = "Hotel5",Stars = 5},
			              		new Hotel{Area = "Area3", Name = "Hotel6",Stars = 1},
			              	};
			this.muzeums = new List<Muzeum>
			               	{
			               		new Muzeum {Area = "Area1", EntranceCost = 100, Name = "Muzeum1"},
			               		new Muzeum {Area = "Area2", EntranceCost = 50, Name = "Muzeum2"},
			               		new Muzeum {Area = "Area3", EntranceCost = 80, Name = "Muzeum3"},
			               		new Muzeum {Area = "Area1", EntranceCost = 150, Name = "Muzeum4"},
			               		new Muzeum {Area = "Area2", EntranceCost = 120, Name = "Muzeum5"},
			               		new Muzeum {Area = "Area3", EntranceCost = 10, Name = "Muzeum6"},
			               		new Muzeum {Area = "Area1", EntranceCost = 40, Name = "Muzeum7"},
			               	};
		}

		/// <summary>
		/// Emulation of table Hotels
		/// </summary>
		public IEnumerable<Hotel> Hotels
		{
			get { return hotels; }
		}

		/// <summary>
		/// Emulation of table Muzeum
		/// </summary>
		public IEnumerable<Muzeum> Muzeums
		{
			get { return muzeums; }
		}

		/// <summary>
		/// Just to satisfy IDisposable interface (for using statement)
		/// </summary>
		public void Dispose()
		{
		}
	}
}